package com.towker;

import javax.servlet.http.HttpServletRequest;

import com.towker.core.util.Environment;


public class ParamFactory
{
	/* Fileupload */
	public static final String FILEUPLOAD_SAVEPATH = ParamFactory.toString(Environment.getStrProperty("fileupload.savePath"), "");
	public static final String FILEUPLOAD_SAVEPATHS = ParamFactory.toString(Environment.getStrProperty("fileupload.savePaths"), "");
	public static final String FILEUPLOAD_PICPATHS = ParamFactory.toString(Environment.getStrProperty("fileupload.picPaths"), "");
	public static final long FILEUPLOAD_MAXSESSIONS = ParamFactory.toLong(Environment.getStrProperty("fileupload.maxSessions"), 500L);
	public static final long FILEUPLOAD_UPLOADMAXSIZE = ParamFactory.toLong(Environment.getStrProperty("fileupload.uploadMaxSize"), 2L);
	public static final long FILEUPLOAD_UPLOADTIMEOUT = ParamFactory.toLong(Environment.getStrProperty("fileupload.uploadTimeout"), 600000L);
	public static final String FILEUPLOAD_EXT_IMG = ParamFactory.toString(Environment.getStrProperty("fileupload.ext.img"), "jpg,jpeg,gif,png");
	public static final String FILEUPLOAD_EXT_DOC = ParamFactory.toString(Environment.getStrProperty("fileupload.ext.doc"), "jpg,jpeg,gif,png,bmp,doc,rtf,xls,txt,ppt,pdf,rar,zip,7z");
	public static final String FILEUPLOAD_EXT_XLS = ParamFactory.toString(Environment.getStrProperty("fileupload.ext.xls"), "xls");
	
	public static final long toLong(String str, long defaultValue)
	{
		try {return Long.parseLong(str);}catch(Exception e) {return defaultValue;}
	}
	public static final String toString(String str, String defaultValue)
	{
		try {if(str == null){return defaultValue;}else{return str;}}catch(Exception e) {return defaultValue;}
	}
	
	public static void main(String[] args)
	{
	}
}
